package com.aitoedu.server.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.aitoedu.server.entity.Student;
import com.aitoedu.server.service.StudentService;
import com.aitoedu.server.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

/**
* @author 曹正豪
* @description 针对表【student(学生信息)】的数据库操作Service实现
* @createDate 2024-08-08 19:20:49
*/
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student>
    implements StudentService{

    @Autowired
    private StudentMapper studentMapper;

    @Override
    public Student pl() {
        Long sid = Long.valueOf((String) StpUtil.getLoginId());
        Student student = studentMapper.selectById(sid);
        if(ObjectUtils.isEmpty(student)) return new Student();
        student.setPassword("******");
        return student;
    }
}




